package com.xp.pgoj.controller;

import com.xp.pgoj.common.BaseResponse;
import com.xp.pgoj.common.ResultUtils;
import com.xp.pgoj.service.RankService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Set;

/**
 * @author <a href=""https://github.com/Fzs0>逢左使</a>
 * @create 2024/10/24 15:05
 * @Description:
 */
@RestController
@RequestMapping("/rank")
@Slf4j
public class RankController {

    @Resource
    private RankService rankService;

    @GetMapping("/getTopNRanks")
    public BaseResponse<Set<ZSetOperations.TypedTuple<String>>> getTopNRanks(@RequestParam int n) {
        return ResultUtils.success(rankService.getTopNRank(n));
    }

}
